//
//  CustomSendTimeCollectionCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/1.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "CustomSendTimeCollectionCell.h"

@interface CustomSendTimeCollectionCell ()


@end


@implementation CustomSendTimeCollectionCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        NSArray *titles = @[@"起始时间", @"结束时间"];
        
        @weakify(self);
        [titles enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            @strongify(self);
            UILabel *label = [UILabel makeLabelWithText:obj textColor:UIColorFromRGB(0x999999) font:mFont(12) textAliment:1];
            label.size = CGSizeMake(120, 35);
            label.mj_y = (frame.size.height - 35)/2.0;
            label.mj_x = (58 + 120)*idx;
            label.backgroundColor =  mBackgroudColor;
            [self addShadowAndCircleCorner:label.layer corner:5];
            [self addSubview:label];
            
            label.tapBlock = ^{
                
                if (idx == 0) {
                    
                    if (self.dealStartBlock) {
                        self.dealStartBlock();
                    }
                    
                }else{
                    
                    if (self.dealEndBlock) {
                        self.dealEndBlock();
                    }
                }
            };
        }];
        
        
        //线条
        CAShapeLayer *line = [CAShapeLayer layer];
        line.fillColor = UIColorFromRGB(0xC4C4C4).CGColor;
        UIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(137, frame.size.height/2.0 , 14, 1)];
        line.path = path.CGPath;
        [self.layer addSublayer:line];

    }
    
    return self;
}

@end
